﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace FIM
{
    public class GamepadButton : SingleInput
    {
        public override bool IsPressed
        {
            get { return IsDown && manager.PreviousGamepad[player].IsButtonUp(button); }
        }
        public override bool IsReleased
        {
            get { return IsUp && manager.PreviousGamepad[player].IsButtonDown(button); }
        }
        public override bool IsDown
        {
            get { return manager.CurrentGamepad[player].IsButtonDown(button); }
        }
        public override bool IsUp
        {
            get { return manager.CurrentGamepad[player].IsButtonUp(button); }
        }

        public override float Value
        {
            get { return IsDown ? 1 * mul : 0; }
        }
        int player;
        Buttons button;

        public GamepadButton(CManager inputManager, PlayerIndex playerIndex, Buttons theButton)
            : this(inputManager, 1, playerIndex, theButton) { }

        public GamepadButton(CManager inputManager, float multiplier, PlayerIndex playerIndex, Buttons theButton)
            : base(inputManager, multiplier)
        {
            player = (int)playerIndex;
            button = theButton;
        }
    }
}
